<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<style>
    .yen{border:none;height:0.75rem;width:0.75rem;display: inline-block;background: #ff4753;color:#fff;font-size:0.4rem;line-height: 0.8rem;text-align: center;
        font-style: normal;border-radius: 0.75rem;-webkit-border-radius: 0.75rem;}
    .order-create-page .fui-list.goods-item .fui-list-inner{
        height: 3.5rem;
        align-self: center;
    }
    .order-create-page .fui-list.goods-item .fui-list-angle{
        height: 3.5rem;
        align-self: center;
    }
    .order-create-page .fui-list-inner .subtitle{
        display: block;
    }
    .fui-header a.back2:before {
        content: " ";
        display: inline-block;
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);
        height: 0.5rem;
        width: 0.5rem;
        border-width: 0 0 2px 2px;
        border-color: #666;
        border-style: solid;
        position: relative;
        top:0;
    }
.fui-btn-c {
    height: auto;
    margin: 0;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
    align-items: center;
    position: relative;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.jylabel-red-0.active::after{content:" ";width:23px;height:24px;background:url(../core/resource/images/gou-red.png) no-repeat;position:absolute;float:right;right:-1px;bottom:-1px;text-align:center;}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category ul li.active a{color:#09ba07;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
.fui-navbar .cartbtn {padding-right:0.3rem;background:#fff;opacity:1}
.fui-navbar .buybtn  {padding-left:0.3rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav,.fee-tag-nav-o {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem}
.fee-tagup {background:{{main.syscolor || 'red'}};color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav {background:{{main.syscolor || 'red'}}; opacity: 0.58;}
.fee-tagup-nav {background:{{main.syscolor || 'red'}};}
.fee-disabled-nav {background:#bbb;color:#fff;}	
.fee-tag-nav-o {background:#fff;color:{{main.syscolor || 'red'}};border: 1px solid {{main.syscolor || 'red'}};}
.coutag {padding:0.1rem 0.2rem;background:#ffedef;color:#db2e2a;font-size:0.55rem;border-radius: 0.2rem;}
</style>
<div class='fui-page order-create-page' ng-if="pagedata.nodatapic_close">
    <div class='fui-content'>
		<div style="width:100%;height:7rem">
			<img ng-src="{{tomedia(pagedata.pluginset.payimg) || '../addons/jy_merchcmi/resource/images/mobile-hdp02.jpg'}}" style="display: block; width: 100%; height: 100%;">
		</div>
        <div ng-if="pagedata.sendtypes" id="carrierTab" class="fui-tab fui-tab-danger" style="margin-bottom: 0">
            <a ng-repeat="(k,v) in pagedata.sendtypes" ng-class="{'active':pagedata.post.sendtype==k}" ng-click="pagedata.post.sendtype=k">{{v}}</a>
        </div>
		<!--地址选择-->
		<div id="addressInfo" ng-show="pagedata.post.sendtype==1" class="fui-cell-group fui-address-group" style="margin-top:0px">
			<div ng-if="pagedata.post.addressid" class="fui-cell" ng-click="pagedata.get_addresslist()">
				<div style="width:100%">
					<div class="fui-cell-text name bold" style="font-size:0.8rem">
						<span style="margin-right:20px">{{pagedata.post.address.name}}</span><span>{{pagedata.post.address.mobile}}</span>
					</div>
					<div class="fui-cell-text name" style="margin-top:5px">	
						<i class="fui-tag fui-tag-red">默认</i>
						<i class="fui-tag fui-tag-blue">家</i>
						{{pagedata.post.address.pcd.province||''}} {{pagedata.post.address.pcd.city ||''}} {{pagedata.post.address.pcd.district||''}} {{pagedata.post.address.address ||''}}
					</div>
				</div>
				<div class="fui-cell-remark"></div>
			</div>
			<div ng-if="!pagedata.post.addressid && pagedata.mid>0" class="fui-cell">
				<div class="fui-cell-info c" ng-click="pagedata.edit_address=1">
						<div class="no-address" style="width:8rem;"><i class="icon jinyunicon icon-tianjia"></i> {{pagedata.item.isnoarea==1?'默认地址不在配送范围,需另加':'添加收货地址'}}</div>
				</div>
			</div>
			<div ng-if="pagedata.mid==0" class='fui-cell-group'>
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:auto;font-size:0.9rem">收货信息</div>
					<div class='fui-cell-info'></div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.post.address.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.post.address.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>
                <div class="fui-cell">
					<div class="fui-cell-label ">地区</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.province" class="form-control tpl-province">
						<option value="" selected="selected">省份</option>
						<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.post.address.pcd.province==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.city" class="form-control tpl-city">
						<option value="" selected="selected">城市</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.post.address.pcd.province]" value="{{value}}" ng-selected="pagedata.post.pcd.city==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.district" class="form-control tpl-district">
						<option value="" selected="selected">区县</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.post.address.pcd.province][pagedata.post.address.pcd.city]" value="{{value}}" ng-selected="pagedata.post.address.pcd.district==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.street" class="form-control tpl-district">
						<option value="" selected="selected">街道</option>
						<option ng-repeat="value in pagedata.province[pagedata.post.address.pcd.province][pagedata.post.address.pcd.city][pagedata.post.address.pcd.district]" value="{{value}}" ng-selected="pagedata.post.address.pcd.street==value">{{value}}</option>
						</select>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.post.address.address" placeholder='街道，楼牌号等'  class="fui-input"/></div>
                </div>
            </div>
		</div>
	<!--自提点选择-->
	<div ng-show="pagedata.post.sendtype==2" class="fui-list-group"  id="carrierInfo" style="margin: 0 0 0.5rem">
					<div class="fui-list" href="javascript:;">
						<div class="fui-list-media">
							<i class="icon icon-map"></i>
						</div>
						<div class="fui-list-inner">
							<div class="subtitle" >
								<span style="overflow: hidden;display: inline-block;">商户</span>
								<span class='realname'>{{pagedata.merch.merchname}}</span>
								
							</div>
							<div class="text address">地址： {{pagedata.merch.address || '无'}}</div>
							<div ng-if="pagedata.table.title" class="red">桌号： {{pagedata.table.title}}</div>
						</div>
						<div class="fui-list-angle">
							<div class="angle"></div>
						</div>
					</div>
	</div>
	<div ng-show="(pagedata.post.sendtype==2 || pagedata.post.sendtype==3) && pagedata.shopset.is_noordermobile!=1 && !pagedata.table.id" class="fui-cell-group" id="memberInfo">
                <div class="fui-cell">
                    <div class="fui-cell-label">联系人</div>
                    <div class="fui-cell-info c000"><input type="text" placeholder="请输入联系人" class="fui-input" ng-model="pagedata.post.realname"/></div>
                </div>
                <div class="fui-cell">
                    <div class="fui-cell-label">联系电话</div>
                    <div class="fui-cell-info c000"><input type="tel" placeholder="请输入联系电话"  class="fui-input" ng-model="pagedata.post.mobile"/></div>
                </div>
    </div>
	<div ng-if="pagedata.showstore_no==1" class="fui-cell-group" id="memberInfo">
          <div class="fui-cell">
              <div class="fui-cell-label">{{pagedata.store_notitle}}</div>
              <div class="fui-cell-info c000"><input type="text" placeholder="请输入{{pagedata.store_notitle}}" class="fui-input" ng-model="pagedata.post.store_no"/></div>
          </div>
    </div>
<div class='jy-content'>
<div class="fui-cell-group">
	<div class="fui-cell">
			<div class="fui-cell-text">
				<div class="bold"><i class="icon icon-bussinesscard" style="color:#f60"></i> 线上会员卡</div>
				<div class="gray" style="font-size:0.55rem">卡内余额￥{{pagedata.member.credit2}}，可用￥{{pagedata.member.credit2}}</div>
			</div>
			<div class="fui-cell-remark noremark bold"><span class='dispatchprice'>-￥{{pagedata.post.credit2de || 0.00}}</span></div>
	</div>
	<div class="fui-cell-title syscolor" style="padding-bottom:0">任选一款，总有一款适合您！</div>
	<div class="fui-icon-group noborder col-3" style="padding:0.3rem">
			<div ng-repeat="item in pagedata.pluginset.conglist" ng-click="pagedata.post.money=item.fee;pagedata.post.moneykey=$index;pagedata.recharge()" class="fui-icon-col-sm" style="margin:0;padding:0 0.2rem;margin-top:0.5rem;">
					<div ng-class="{'btn btn-success-o':1,'active':pagedata.post.money==item.fee}" style="border-radius:0.2rem;line-height:1.4;margin:0;padding:1rem 0.3rem;width:100%">
					<div class="bold">充{{item.fee}}送{{item.songfee}}</div>
					</div>
			</div>
	</div>
	<div class="fui-cell">
			<div class="fui-cell-label" style="width:100px">商品金额</div>
			<div class="fui-cell-info"></div>
			<div class="fui-cell-remark noremark bold"><span class='dispatchprice'>
			￥{{price(pagedata.order.total_price) || '0.00'}}
			</span></div>
	</div>
	<div class="fui-cell" ng-if="pagedata.post.invoice =='1'">
        <div class="fui-cell-label" style="width:100px">发票抬头</div>
        <div class="fui-cell-text bold r"><span style="color:red">电子</span>({{pagedata.post.invoicegoodstype !=2?'商品明细':'商品类别'}}-{{pagedata.post.fapiaotype2 !=2?'个人':'单位'}})</div>
		<div class="fui-cell-remark" ng-click="pagedata.showfapiao=true"></div>
    </div>
	<div id='coupondiv' class="fui-cell fui-cell-click">
		<div class='fui-cell-label' style='width:auto;'>优惠券</div>
		<div class='fui-cell-text bold r'>{{pagedata.post.title5}}</div>
		<div class="fui-cell-remark" ng-click="pagedata.showcoupon=true;">
			<div ng-if="pagedata.coupons.length>1" class="badge">{{pagedata.coupons.length}}</div>
			<span ng-if="pagedata.coupons.length<=0" class='text'>{{pagedata.order.exitnomerch?'无该商户可用优惠券':'无可用'}}</span>
		</div>
	</div>
	<div ng-if="pagedata.order.taskdiscountprice" class="fui-cell istaskdiscount">
        <div class="fui-cell-label" style='width:auto' >任务活动优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"><span id='showtaskdiscountprice' class='dispatchprice'>-￥{{pagedata.order.taskdiscountprice}}</span></div>
    </div>
    <div ng-if="pagedata.order.taskcut>0" class="fui-cell taskcut" >
        <div class="fui-cell-label" style='width:auto' >任务中心优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"><span id='showtaskcut' class='dispatchprice'>-￥{{pagedata.order.taskcut}}</span></div>
    </div>
    <div ng-if="pagedata.order.lotterydiscountprice>0" class="fui-cell islotterydiscount">
        <div class="fui-cell-label" style='width:auto' >游戏活动优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"> <span id='showlotterydiscountprice' class='dispatchprice'>-￥{{pagedata.order.lotterydiscountprice}}</span></div>
    </div>
    <div ng-if="pagedata.order.level_de_price>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto' >会员优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"><span id='showdiscountprice' class='dispatchprice'>-￥{{price(pagedata.order.level_de_price)}}</span></div>
    </div>
	<div ng-if="pagedata.order.luck_de_price>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto' >运势优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"><span id='showdiscountprice' class='dispatchprice'>-￥{{price(pagedata.order.luck_de_price)}}</span></div>
    </div>
	<div ng-if="pagedata.order.buyxiu_de_price>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto' >买家秀优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"> <span id='showdiscountprice' class='dispatchprice'>-￥{{price(pagedata.order.buyxiu_de_price)}}</span></div>
    </div>
    <div ng-if="pagedata.order.isdiscountprice>0" class="fui-cell isdiscount">
        <div class="fui-cell-label" style='width:auto' >促销优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold"><span id='showisdiscountprice' class='dispatchprice'>-￥{{price(pagedata.order.isdiscountprice)}}</span></div>
    </div>
    <div ng-if="pagedata.saleset.enough.length>0" class="fui-cell" id="deductenough">
		<div class="fui-cell-label" style='width:auto' >商城优惠 <span style="font-size: .6rem">：单笔满 ￥<span id="deductenough_enough">{{pagedata.order.enough.man}}</span> 元立减￥{{pagedata.order.enough.jian}}</span></div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold"> <span class='dispatchprice'>-￥{{price(pagedata.order.enough.jian)}}</span></div>
	</div>
	<div ng-if="pagedata.order.sale_enough.length>0" class="fui-cell" id="merch_deductenough">
		<div class="fui-cell-label" style='width:auto' >单笔满 <span id="merch_deductenough_enough" class='text-danger'>{{pagedata.order.sale_enough[0].man}}</span> {{pagedata.order.sale_enough[0].isnum?'件':'元'}}立减</div>
		<div class="fui-cell-info"></div>
		<div ng-if="pagedata.order.sale_enough[0].type!=1" class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.sale_enough[0].jian)}}</span></div>
		<div ng-if="pagedata.order.sale_enough[0].type==1" class="fui-cell-remark noremark bold">打 <span class='dispatchprice'>{{pagedata.order.sale_enough[0].rate}}</span>折</div>
	</div>
	<div ng-if="pagedata.order.deduct_credit>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto' >积分抵扣（消耗积分<span class="red">{{pagedata.order.delcredit1}}</span>）</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">
		<span id='showdiscountprice' class='dispatchprice'>-￥{{price(pagedata.order.deduct_credit)}}</span>
		<span style="width:2rem"><input class="weui_switch" type="checkbox" ng-checked="pagedata.post.no_deduct_credit!=1" ng-click="pagedata.no_deduct_credit();"></span>
		</div>
    </div>
	<div ng-if="pagedata.order.last_cardfee>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto'>购物卡抵扣（面值余额<span class="red">{{pagedata.order.last_cardfee}}</span>）</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">
		<span ng-show="pagedata.post.sendtype==1" class='dispatchprice'>-￥{{pagedata.order.di_cardfee}}</span>
		<span ng-show="pagedata.post.sendtype!=1" class='dispatchprice'>-￥{{pagedata.order.no_dispatch_cardfee}}</span>
		<span style="width:2rem"><input class="weui_switch" type="checkbox" ng-checked="pagedata.post.no_di_cardfee!=1" ng-click="pagedata.no_di_cardfee();"></span>
		</div>
    </div>
	<div ng-if="pagedata.order.seckillprice" class="fui-cell" id="seckillprice">
		<div class="fui-cell-label" style='width:auto' >秒杀优惠</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold"><span class='dispatchprice'>-￥{{price(pagedata.order.seckillprice)}}</span></div>
	</div>
	<div ng-if="pagedata.order.packageprice" class="fui-cell" id="showpackageprice">
		<div class="fui-cell-label" >套餐优惠</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			&yen; <span class='packageprice'>-{{price(pagedata.order.packageprice)}}</span>
		</div>
	</div>
	<div ng-if="pagedata.post.couponid" class="fui-cell">
		<div class="fui-cell-label" style='width:auto' >{{pagedata.post.title5}}(优惠券)</div>
		<div class="fui-cell-info"></div>
		<div ng-if="pagedata.post.backtype!=1" class="fui-cell-remark noremark bold"><span class='dispatchprice'>-￥{{pagedata.post.deduct}}</span></div>
		<div ng-if="pagedata.post.backtype==1" class="fui-cell-remark noremark bold"><span class='dispatchprice'>{{pagedata.post.discount}}</span>折</div>
	</div>
	<div ng-if="pagedata.order.credit" class="fui-cell">
		<div class="fui-cell-label">送积分</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='packageprice'><span class="red">{{pagedata.order.credit}}</span>个</span>
		</div>
	</div>
	<div ng-repeat="cv in pagedata.order.credit3" class="fui-cell">
		<div class="fui-cell-label">送{{cv.title}}</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='packageprice'><span class="red">{{cv.credit}}</span>个</span>
		</div>
	</div>
	<div ng-if="pagedata.order.fang_credit2>0" class="fui-cell">
		<div class="fui-cell-label">返现</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='packageprice'>￥{{pagedata.order.fang_credit2}}</span>
		</div>
	</div>
	<div ng-if="pagedata.post.sendtype==1" class="fui-cell" id="showdispatchprice">
		<div ng-if="pagedata.order.is_peisong!=1" class="fui-cell-label" style="width:auto">运费（总重:{{pagedata.order.total_weight}}g）<span ng-if="pagedata.order.baoyou_man>0" class="subtitle">满{{pagedata.order.baoyou_man}}元包邮</span></div>
		<div ng-if="pagedata.order.is_peisong==1" class="fui-cell-label" style="width:auto">配送费（{{pagedata.order.peisong_juli}}km）<span ng-if="pagedata.order.baoyou_man>0" class="subtitle">满{{pagedata.order.baoyou_man}}元免配送费</span><span ng-if="pagedata.order.teshufee>0" class="subtitle">恶劣环境费￥{{pagedata.order.teshufee}}</span><span ng-if="pagedata.order.lateye_fee>0" class="subtitle">深夜费￥{{pagedata.order.lateye_fee}}</span></div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold"><span class="dispatchprice">￥{{price(pagedata.order.dispatchprice) || '0.00'}}</span> <span ng-if="pagedata.order.isonebaoyou" class="subtitle">部分免邮</span> <span ng-if="pagedata.order.addbaoyoufee>0" class="delete">￥{{price(pagedata.order.addbaoyoufee) || '0.00'}}</span></div>
	</div>
	<div ng-if="pagedata.order.out_upfee>0 && !pagedata.table.title" class="fui-cell">
		<div class="fui-cell-label">打包费</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='dispatchprice'>￥{{pagedata.order.out_upfee}}</span>
		</div>
	</div>
</div>
<div ng-if="pagedata.post.sendtype==1 && pagedata.post.is_peisong==1" class="fui-cell-group" style="padding:0 0.65rem;padding-bottom:1rem">
		<div class="fui-cell-title bold" style="padding: 0.5rem 0rem;">配送时间</div>
		<div class="col-jy-2" style="padding:0">
					<a href="javascript:;" ng-click="pagedata.post.make_type=0" ng-class="{'fui-btn-c jylabel jylabel-red-0':1, 'active':pagedata.post.make_type==0}" style="border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0.3rem;border-bottom-left-radius:0.3rem;">
						<i class="icon icon-peisong"></i>
						<div class="info"><div class="bold" style="line-height:1">{{pagedata.pluginset.on_feejia==1?'加急配送':'立即配送'}}</div><div style="line-height:1">Dine IN</div></div>
					</a>
		</div>
		<div ng-if="pagedata.citypeisong.no_yuyuepei!=1" class="col-jy-2">
					<a href="javascript:;" ng-click="pagedata.selecttime();pagedata.post.make_type=1"  ng-class="{'fui-btn-c jylabel jylabel-red-0':1, 'active':pagedata.post.make_type==1}">
						<i class="icon icon-daishouhuo1"></i>
						<div class="info"><div class="bold" style="line-height:1">预约配送</div>
							<div ng-if="!pagedata.post.out_time" style="line-height:1">Take Away</div>
							<div ng-if="pagedata.post.out_time" style="line-height:1;font-size:0.6rem">约{{pagedata.post.out_time}}送达</div>
						</div>
					</a>
		</div>
</div>
</div>
<div id="showdelivery"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0;">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">配送</div>
				</div>
				<div class="fui-cell">
					<div class="tag">
						<span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.sendtype==1}" style="margin-right:10px;" ng-click="pagedata.post.sendtype=1">快递配送</span><span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.sendtype==2}" style="margin-right:10px;" ng-click="pagedata.post.sendtype=2">上门自提</span>
					</div>
				</div>
			</div>
			<div ng-if="pagedata.post.sendtype !=2" class="fui-cell-group" style="margin-top:-10px">
					<div class="fui-cell">
						<div class="fui-cell-label" style="width:100px">送达时间</div>
						<div class="fui-cell-text bold r"><span style="color:red">预计</span>({{pagedata.post.deliverytime}}送达)</div>
						<div class="fui-cell-remark" onclick="$('#showsendtime').modal();" ng-click=""></div>
					</div>
			</div>
			<div ng-if="pagedata.post.sendtype ==2" class="fui-cell-group" style="margin-top:-10px">
					<div class="fui-cell">
						<div class="fui-cell-label" style="width:100px">自提地点</div>
						<div class="fui-cell-text bold r"><span style="color:red">{{pagedata.selectstore.pcd.city}}</span>({{pagedata.selectstore.pcd.district}} {{pagedata.selectstore.pcd.street}} {{pagedata.selectstore.address}})</div>
						<div class="fui-cell-remark" onclick="$('#showstores').modal();"></div>
					</div>
			</div>
			<div class="fui-navbar" style="padding:0.35rem 1rem">
				<a aria-hidden="true" data-dismiss="modal" href="javascript:;" class="btn btn-danger btn-banf" style="margin:0;width:100%">确定</a>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('order/common/_fapiao','','','jy_weishop')"></div>
<div ng-if="pagedata.showcoupon" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-top:1rem">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showcoupon=false"></i>
			<div ng-include="sys_html('coupon/common/_picker','','','jy_merch')"></div>
		</div>
	</div>
</div>
<div ng-if="pagedata.modal_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-bottom:2.5rem">
		<i class="closed icon icon-close" style="color:red;top:0.3rem" ng-click="pagedata.modal_address=0"></i>
		<div class="fui-list-group modal-swiper-y" style='margin-top:5px;background:#fff;'>
			<div class="fui-list address-item" ng-repeat="item in pagedata.address_list">
				
				<div class="fui-list-inner">
					<div class="title" ng-click="pagedata.change_address(item)"><span class='realname'>{{item.name}}</span> <span class='mobile'>{{item.mobile}}</span></div>
					<div class="text" ng-click="pagedata.change_address(item)"><span class='address'>{{item.pcd.province}} {{item.pcd.city}} {{item.pcd.district}} {{item.address}}</span></div>
					<div class='bar' style="line-height:1.4">
						<span class='pull-right'>
							<a class="external" href="javascript:;" ng-click="pagedata.item.diyfields=item.diyfields;pagedata.edit_address=1;pagedata.item.address=item;pagedata.isaddaddress=0">
							<i class='icon icon-bianji'></i> 编辑
							</a>
							<a class='external' href="javascript:;" ng-click="pagedata.del_address($index)">
							<i class='icon icon-shanchu'></i> 删除
							</a>
						</span>
						<label class='radio-inline'  ng-click="pagedata.setaddress($index);pagedata.change_address(item)">
							<input type="radio" class="fui-radio  fui-radio-danger" ng-checked="item.isdefault==1"/> 设置默认
						</label>
					</div>
				</div>
			</div>
			<div ng-if="!pagedata.address_list || pagedata.address_list.length<1" class='content-empty' style="margin-top:0">
						<i class='icon icon-map' style="font-size:2rem"></i>
						<div style="padding-bottom:0.5rem">目前没有合适的地址！</div>
			</div>
		</div>
		<div class='fui-navbar' style="padding:0.35rem 1rem">
			<a class="btn btn-danger btn-banf" style="margin:0;width:100%" ng-click="pagedata.item.diyfields=pagedata.addressdiyform;pagedata.edit_address=1;pagedata.post.address.address='';pagedata.isaddaddress=1"><i class="icon icon-tianjia" style="font-size:0.8rem"></i> 添加地址</a>
		</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.edit_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
			<div class='fui-cell-group modal-swiper-y' style="border-radius: 0.5rem;margin-top:0;height:auto;max-height:23rem;min-height:20rem;padding-bottom:2.5rem">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.8rem">编辑地址</div>
					<div class='fui-cell-info' ng-if="pagedata.openid && pagedata.isaddaddress==1 && pagedata.fromh5wxapp!=1"><span class="syscolor" ng-click="pagedata.openAddress()">添加微信地址</span></div>
				</div>
				<div ng-if="!pagedata.item.address.id && pagedata.jy_aiaddress.isopen==1" class="fui-cell">
					<div class="fui-cell-info c000">
						<textarea rows="2" placeholder="请输入要解析的地址" ng-model="pagedata.address.apiaddress"></textarea>
						<div ng-click="pagedata.jieaddress();" class="label label-success" style="position: absolute;right:1rem;bottom:1.3rem">解析地址</div>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.item.address.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.item.address.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>
                <div class="fui-cell">
					<div class="fui-cell-label" style="width:2.3rem">地区</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.item.address.pcd.province" class="form-control tpl-province">
						<option value="" selected="selected">省份</option>
						<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.item.address.pcd.province==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.item.address.pcd.city" class="form-control tpl-city">
						<option value="" selected="selected">城市</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.item.address.pcd.province]" value="{{value}}" ng-selected="pagedata.item.address.pcd.city==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.item.address.pcd.district" class="form-control tpl-district">
						<option value="" selected="selected">区县</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.item.address.pcd.province][pagedata.item.address.pcd.city]" value="{{value}}" ng-selected="pagedata.item.address.pcd.district==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.item.address.pcd.street" class="form-control tpl-district">
						<option value="" selected="selected">街道</option>
						<option ng-repeat="value in pagedata.province[pagedata.item.address.pcd.province][pagedata.item.address.pcd.city][pagedata.item.address.pcd.district]" value="{{value}}" ng-selected="pagedata.item.address.pcd.street==value">{{value}}</option>
						</select>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
					 <div class='fui-cell-info'>
						<textarea rows="2" placeholder="街道，楼牌号等" ng-model="pagedata.item.address.address"></textarea>
					</div>
                </div>
				<div ng-include="sys_html('common/_diyform_item',true)"></div>
            </div>
			<div class="fui-navbar" style="padding:0.35rem 1rem">
				<a href="javascript:;" ng-click="pagedata.add_address();" class="btn btn-danger btn-banf" style="margin:0;width:100%">确定</a>
			</div>
			<i ng-click="pagedata.edit_address=0" class="closed icon icon-cuowu"></i>
		</div>
	</div>
</div>
</div>
<div class="fui-navbar-tip" ng-if="pagedata.shopset.open_tips==1"><i class="icon icon-information" style="font-size:0.6rem;color:red"></i> {{pagedata.shopset.tips}}</div>
<div class="fui-navbar order-create-checkout">
    <a href="javascript:;" class="nav-item total" style="text-align:left;padding-left:0.5rem">
        <span ng-show="pagedata.post.sendtype==1" class="text-danger bigprice">&yen; 
			<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.endprice) || '0.00'}}</span>
		</span>
		<span ng-show="pagedata.post.sendtype!=1" class="text-danger bigprice">&yen; 
			<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.no_dispatch_price) || '0.00'}}</span>
		</span>
    </a>
	<a href="javascript:;" class="nav-item btn buybtn" ng-click="access_json('/order.check//id='+pagedata.order.id+'&fromcreate=1')" >
		<div class="fee-tag-nav-o">
			查看订单
		</div>
	</a>
    <a href="javascript:;" class="nav-item btn buybtn" ng-if="(pagedata.order.no_out_price==0 && pagedata.order.outarea!=1) || pagedata.post.sendtype!=1" ng-click="pagedata.pay_submit(pagedata.post,'jy_merchcmi/order.create/post/','/order.list//fromcreate=1')" >
		<div class="fee-tagup-nav">
			立即支付
		</div>
	</a>
	<a href="javascript:;" class="nav-item btn buybtn" ng-if="(pagedata.order.no_out_price>0 || pagedata.order.outarea==1) && pagedata.post.sendtype==1">
		<div class="fee-disabled-nav">
			<span ng-if="pagedata.order.no_out_price>0 && pagedata.order.outarea!=1 && pagedata.order.isnocity!=1">满{{pagedata.order.no_out_price}}元起送</span>
			<span ng-if="pagedata.order.outarea==1 || pagedata.order.isnocity==1">{{pagedata.order.isnocity==1?'不在同城':'超出配送范围'}}</span>
			{{pagedata.order.maxout_juli && pagedata.order.isnocity==1 ?pagedata.order.maxout_juli+'km':''}}
		</div>
	</a>
</div>
<div id="showstoreitem"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">{{pagedata.storeitem.title}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">地址：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.pcd.province}} {{pagedata.storeitem.pcd.city}} {{pagedata.storeitem.pcd.district}} {{pagedata.storeitem.pcd.street}} {{pagedata.storeitem.address}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">联系人：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.realname}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">联系电话：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.mobile}}</div>
				</div>
			</div>
			<div class="fui-navbar" style="padding:0.35rem 1rem">
				<a href="javascript:;"  aria-hidden="true" data-dismiss="modal" class="btn btn-danger btn-banf" style="margin:0;width:100%">关闭</a>
			</div>
		</div>
	</div>
</div>

<!-- 放弃付款-->
<div ng-if="pagedata.checkcancel" class="popup">
			<div class="popup-body">
			<div class="popup-center" style="border-radius:0.2rem;">
				<div class="fui-page-title" style="margin-top:1rem">确定要取消订单吗？</div>
				<div class="fui-page-subtitle" style="margin-top:0.1rem">喜欢的商品可能随时会被抢空哦</div>
				<div class="modal-footer" style="margin-top:2rem">
					<a ng-click="pagedata.checkcancel=false" class="mod-fail">取消</a>
					<a href="javascript:" ng-click="post({},'cancel','id='+pagedata.order.id);pagedata.checkcancel=false" class="mod-success" style="background:red">确定</a>
				</div>
			</div>
			</div>
</div>
<div id="selecttime" class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
	<div class="modal-dialog" style="width:100%;bottom:0%;left:0%;">
	<div class="modal-content" style="border-radius: 4px;">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="color:#ddd;top:0.2rem;right:0.2rem"><i class="icon icon-wrong" style="font-size:1.3rem;"></i></div>
		<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
			<div class="text green" style="background-color:#fff" >请选择{{pagedata.post.sendtype==3?'自取':'送达'}}时间</div>
		</div>
		<div class="row margin0">
			<div class="col-xs-3">
				<div class="parent-category" id="delivery-time-parent">
					<ul>
							<li ng-class="{'active':pagedata.post.dayid==$index}" ng-repeat="(key,value) in pagedata.out_time.days"><a href="javascript:;" ng-click="pagedata.post.dayid=$index">{{value}}</a></li>
					</ul>
				</div>
			</div>
			<div class="col-xs-9" style="padding-left:0;padding-bottom:1rem">
				<div class="children-category" id="delivery-time-children">
					<div class="children-category-wrapper">
						<ul id="category1" aria-hidden="true" data-dismiss="modal" style="height:19rem">
								<li ng-show="pagedata.out_time.lasttimebox != 0 || pagedata.post.dayid!=0" class="time-flag"><a href="javascript:;" ng-click="pagedata.post.out_time=pagedata.predict_time">尽快{{pagedata.post.sendtype==3?'自取':'送达'}} <span ng-if="pagedata.post.sendtype!=3">(配送费￥{{pagedata.out_time.times[0].out_pay}})</span></a></li>
								<li ng-show="pagedata.out_time.lasttimebox != 0 || pagedata.post.dayid!=0" class="delivery-tips time-flag" style="color:#09ba07">约{{pagedata.predict_time}}{{pagedata.post.sendtype==3?'自取':'送达'}}</li>
								<li ng-repeat="item in pagedata.out_time.times" ng-click="pagedata.post.out_time=item.timev" ng-class="{'hide init-hide':(item.timestamp <= pagedata.timestamp && pagedata.post.dayid==0)}">
									<a href="javascript:;">{{item.timev}} <span ng-if="pagedata.post.sendtype!=3">({{item.out_pay}})</span></a>
								</li>
								<div class="content-empty" ng-show="pagedata.out_time.lasttimebox == 0 && pagedata.post.dayid==0">
									  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;font-size:1.7rem"></i><br/><p style="color: #999;font-size: .75rem">当天没有{{pagedata.post.sendtype==3?'自取':'送达'}}时间段！</p>
								</div>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</div>
<div ng-if="pagedata.showtostoretime" class="popup">
		<style>
		.jyui_cell_col .red {
			background: red;
		}
		</style>
			<div class="popup-body">
			<div class="popup-bottom" style="border-radius:0.2rem;">
				<i class="closed icon icon-cuowu" ng-click="pagedata.showtostoretime=false"></i>
				<div class="fui-page-title" style="margin-top:1rem">选择要上门消费的时间！</div>
				<div class="fui-page-subtitle" style="margin-top:0.1rem">请在指定时间上门消费哦，不然可能门店没营业哦！</div>
				<div class="weui_cells_radio3">
					<div class="fui-icon-group noborder col-5">
					<div class="fui-icon-col" ng-repeat="item in pagedata.work_timedata" style="margin-top:0">
						<label class="jyui_cell_col">
							<div ng-if="item.iswork==1" ng-class="{'coltime colchecked':1,'red':pagedata.post.tostoretime==item.riqi}" ng-click="pagedata.post.tostoretime=item.riqi;pagedata.post.tostoreday=item.day">
								<div class="timetitle"><span>{{item.riqi}}</span></div>
								<div class="timetitle"><span>{{item.xinq}}</span></div>
							</div>
							<div ng-if="item.iswork!=1" class="coltime">
								<div class="timetitle"><span>{{item.riqi}}</span></div>
								<div class="timetitle"><span>{{item.xinq}}</span></div>
							</div>
						</label>
					</div>
					</div>
				</div>
			</div>
			</div>
</div>
<script language='javascript'>
scope.pagedata.pay_submit=function(post,post_url,complete_url){
	var str = /^[1][3,4,5,6,7,8,9][0-9]{9}$///手机
    var strname =  /^[\u4e00-\u9fa5]+(·[\u4e00-\u9fa5]+)*$/ //中文
    var stremail = /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
    var filedata = scope.pagedata.post.diyfields?scope.pagedata.post.diyfields:[]
	for (var i=0;i<filedata.length;i++){
		if((filedata[i].ismust ==1 || filedata[i].ismust ==1) && !filedata[i].data){
			scope.message(filedata[i].title +'-不能为空！','error');
			return false
		}
		if(filedata[i].type ==8 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(str.test(filedata[i].data))){
			  scope.message("请输入正确的手机号码！",'error')
			   return false;
			}
		}
		if(filedata[i].type ==9 && (filedata[i].ismust ==1 || filedata[i].ismust ==1)){
			if(!(stremail.test(filedata[i].data))){
			  scope.message("请输入正确的邮箱！",'error')
			   return false;
			}
		}
	}
	if(scope.pagedata.mid==0 && post.sendtype==1){
		if(!(str.test(post.address.mobile))){
				  scope.message("请输入正确的手机号码！",'error')
				  return false;
		}
		if(!post.address.name){
				  scope.message("请输入收货人！",'error')
				  return false;
		}
		if(!post.address.address){
				  scope.message("请输入正确的收货地址！",'error')
				  return false;
		}
	}
	post.peisong_juli=scope.pagedata.order.peisong_juli
	scope.post_json(post_url,post,function(result){
		scope.pagedata.order_id=result.order_id;
		var success_url=result.success_url?result.success_url:complete_url
		var error_url=result.error_url?result.error_url:complete_url
		scope.$evalAsync();
		
		var onemerchid=scope.pagedata.onemerchid;
		scope.tool.pay(result.pay_id,function(res){
				if(res.type=='success'){
					scope.message('支付成功！','success',success_url);
				}else{
					scope.message('支付失败！','success',error_url);
				}
		},'','',success_url,error_url,onemerchid);
	
	});
}
// 百度地图API功能
scope.pagedata.getstores=function(lat_lng){
	var id=scope.pagedata.order.list[0]?scope.pagedata.order.list[0].id:'';
	scope.post_json('jy_weishop/get_data/getstores/',{'lat_lng':lat_lng,'id':id},function(res){
			scope.pagedata.stores =res.stores
			if(res.stores && res.stores.length>0){
				scope.pagedata.carrier_list=res.stores;
			}
			scope.pagedata.stores_count =res.stores_count
			scope.$evalAsync();
	});
}
scope.pagedata.jl=function(lat_lng){
	scope.post_json('/order.create/juli/',{'lat_lng':lat_lng,'juli':scope.pagedata.juli},function(res){
			if(res=='success'){
				
			}
	});
}
scope.pagedata.setting=scope.pagedata.setting?scope.pagedata.setting:{}
window.scope.location(function(res){
	scope.pagedata.item.address=scope.pagedata.item.address?scope.pagedata.item.address:{}
	if(!scope.pagedata.item.address.pcd){
			scope.pagedata.item.address.pcd={}
			scope.pagedata.item.address.pcd.province = res.addressComponents.province;
			scope.pagedata.item.address.pcd.city = res.addressComponents.city;
			scope.pagedata.item.address.pcd.district = res.addressComponents.district;
			scope.pagedata.item.address.pcd.street = res.addressComponents.street;	
			scope.pagedata.post.address.pcd=scope.pagedata.item.address.pcd
	}
	if(scope.pagedata.juli>0 && scope.pagedata.post.sendtype==1){
		scope.pagedata.jl(res.lat_lng);
	}
	if(!scope.pagedata.post.merchid){
		scope.pagedata.getstores(res.lat_lng);
	}
},scope.pagedata.setting.no_location);

scope.pagedata.setaddress=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/set/id='+id+'&get=1',function(res){
		for(var i in scope.pagedata.address_list){
				scope.pagedata.address_list[i].isdefault=0
		}
		scope.pagedata.address_list[index].isdefault=1
		scope.pagedata.post.addressid=id
		scope.pagedata.modal_address=0;
		scope.message('设置成功');
		scope.$evalAsync();
	});
}
scope.pagedata.del_address=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/del/id='+id+'&get=1',function(res){
		scope.pagedata.address_list.splice(index,1);
		scope.message('删除成功');
		scope.$evalAsync();
	});
}
scope.pagedata.get_addresslist=function(){
	scope.pagedata.item.address.res=1
	scope.get('jy_weishop/get_data/get_addresslist/',function(res){
		scope.pagedata.address_list=res.list;
		scope.pagedata.modal_address=1;
		scope.$evalAsync();	
	});
}
scope.pagedata.add_address=function(){
	scope.pagedata.item.address.res=1
	if(scope.pagedata.isaddaddress==1){
		scope.pagedata.item.address.id=0;
	}
	scope.pagedata.post.address=scope.pagedata.item.address;
	scope.pagedata.item.address.diyfields=scope.pagedata.item.diyfields;
	scope.post_json('core/member.address/post/',scope.pagedata.item.address,function(res){
			scope.pagedata.post.addressid =res;
			scope.get('jy_merch/order.create/get_freight/showbaoyou=1&addressid='+res+'&merchid='+scope.pagedata.post.merchid,function(freight){
				scope.pagedata.post.endprice=parseFloat(scope.pagedata.order.no_dispatch_price2)+parseFloat(freight.fee);
				if(scope.pagedata.order.last_cardfee>0 && scope.pagedata.order.no_di_cardfee!=1){
					scope.pagedata.post.endprice -=scope.pagedata.order.last_cardfee;
				}
				scope.pagedata.order.dispatchprice=freight.fee;
				scope.pagedata.post.dispatchprice=freight.fee;
				scope.pagedata.order.addbaoyoufee=freight.addbaoyoufee;
				scope.pagedata.order.isonebaoyou=freight.isonebaoyou;
				scope.pagedata.edit_address=0;
				scope.pagedata.modal_address=0;
				scope.pagedata.order.is_peisong=freight.is_peisong==1?freight.is_peisong:0;
				scope.pagedata.post.is_peisong=scope.pagedata.order.is_peisong;
				if(scope.pagedata.sendtypes && scope.pagedata.sendtypes[1]){
					scope.pagedata.sendtypes[1]=scope.pagedata.order.is_peisong==1?'同城配送':'快递配送';
				}
				if(scope.pagedata.post.endprice<=0){
					scope.pagedata.post.endprice=0.00;
				}
				scope.pagedata.order.outarea=freight.outarea;
				scope.pagedata.order.isnocity=freight.iscity==1?0:1;
				scope.pagedata.order.no_out_price=freight.no_out_price?freight.no_out_price:0;
				scope.pagedata.order.baoyou_man=freight.baoyou_man?freight.baoyou_man:0;
				scope.pagedata.order.peisong_juli=freight.juli?freight.juli:scope.pagedata.order.peisong_juli;
				scope.$evalAsync();
			});
	});
}
scope.pagedata.change_address=function(res){
	scope.pagedata.post.address=res;
	scope.pagedata.post.addressid=res.id;
	scope.get('jy_merch/order.create/get_freight/showbaoyou=1&addressid='+res.id+'&merchid='+scope.pagedata.post.merchid,function(freight){
		console.log('change_address');console.log(freight);
		scope.pagedata.post.endprice=parseFloat(scope.pagedata.order.no_dispatch_price2)+parseFloat(freight.fee);
		if(scope.pagedata.order.last_cardfee>0 && scope.pagedata.order.no_di_cardfee!=1){
			scope.pagedata.post.endprice -=scope.pagedata.order.last_cardfee;
		}
		scope.pagedata.order.dispatchprice=freight.fee;
		scope.pagedata.post.dispatchprice=freight.fee;
		scope.pagedata.order.addbaoyoufee=freight.addbaoyoufee;
		scope.pagedata.order.isonebaoyou=freight.isonebaoyou;
		scope.pagedata.modal_address=0;
		scope.pagedata.order.is_peisong=freight.is_peisong==1?freight.is_peisong:0;
		scope.pagedata.post.is_peisong=scope.pagedata.order.is_peisong;
		if(scope.pagedata.sendtypes && scope.pagedata.sendtypes[1]){
			scope.pagedata.sendtypes[1]=scope.pagedata.order.is_peisong==1?'同城配送':'快递配送';
		}
		if(scope.pagedata.post.endprice<=0){
			scope.pagedata.post.endprice=0.00;
		}
		scope.pagedata.order.outarea=freight.outarea;
		scope.pagedata.order.isnocity=freight.iscity==1?0:1;
		scope.pagedata.order.no_out_price=freight.no_out_price?freight.no_out_price:0;
		scope.pagedata.order.baoyou_man=freight.baoyou_man?freight.baoyou_man:0;
		scope.pagedata.order.peisong_juli=freight.juli?freight.juli:scope.pagedata.order.peisong_juli;
		scope.$evalAsync();
				
	});
	
}
scope.pagedata.checkcoupon=function(type){
	if(type){
		scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price - scope.pagedata.post.coupon_de_price
		if(scope.pagedata.post.no_dispatch_price<0){
			scope.pagedata.post.no_dispatch_price=0
		}
		scope.pagedata.post.endprice = scope.pagedata.order.endprice - scope.pagedata.post.coupon_de_price
		if(scope.pagedata.post.endprice<0){
			scope.pagedata.post.endprice=0
		}
	}else{
		scope.pagedata.post.couponid=0;
		if(scope.pagedata.post.backtype!=1){
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price
			scope.pagedata.post.endprice = scope.pagedata.order.endprice
		}else{
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price;
			scope.pagedata.post.endprice = scope.pagedata.order.endprice		
		}
	}
	scope.pagedata.showcoupon=false;
	scope.$evalAsync();
}
scope.pagedata.selecttime=function(){
	$('#selecttime').modal();
	var merchid=scope.pagedata.post.merchid
	scope.get('jy_merch/get_data/out_time/merch_id='+merchid+'&out_pay='+scope.pagedata.order.dispatchprice,function(res){
		scope.pagedata.out_time=res.out_time;
		scope.pagedata.predict_time=res.predict_time;
		scope.pagedata.post.out_time=scope.pagedata.post.out_time?scope.pagedata.post.out_time:res.predict_time
		scope.pagedata.timestamp=res.timestamp;
		scope.$evalAsync();
	});
}
scope.pagedata.openAddress=function (){
	wx.openAddress({
		  success: function (res) {
			scope.pagedata.item.address={}
			scope.pagedata.item.address.name = res.userName; // 收货人姓名
			scope.pagedata.item.address.pcd={}
			scope.pagedata.item.address.pcd.province = res.provinceName; // 国标收货地址第一级地址（省）
			scope.pagedata.item.address.pcd.city = res.cityName; // 国标收货地址第二级地址（市）
			scope.pagedata.item.address.pcd.district = res.countryName; // 国标收货地址第三级地址（国家）
			scope.pagedata.item.address.address = res.detailInfo; // 详细收货地址信息
			scope.pagedata.item.address.mobile = res.telNumber; // 收货人手机号码
			scope.$evalAsync();
		  },
		  fail: function (res) {
			console.log('fail');console.log(res)
		  }
	});
}
$("input,select").blur(function(){
        setTimeout(function() {
                var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
                window.scrollTo(0, Math.max(scrollHeight - 1, 0));
            }, 100);
})
scope.pagedata.getprovince=function(){
	scope.get('jy_weishop/get_data/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
scope.pagedata.no_deduct_credit=function(){
	scope.pagedata.post.no_deduct_credit=scope.pagedata.post.no_deduct_credit==1?0:1;
	if(scope.pagedata.post.no_deduct_credit==1){
		scope.pagedata.post.no_dispatch_price = scope.pagedata.post.no_dispatch_price+parseFloat(scope.pagedata.order.deduct_credit)
		scope.pagedata.post.endprice = scope.pagedata.post.endprice+parseFloat(scope.pagedata.order.deduct_credit)
	}else{
		scope.pagedata.post.no_dispatch_price = scope.pagedata.post.no_dispatch_price-parseFloat(scope.pagedata.order.deduct_credit)
		scope.pagedata.post.endprice = scope.pagedata.post.endprice-parseFloat(scope.pagedata.order.deduct_credit)
	}
	scope.$evalAsync();
}
scope.pagedata.no_di_cardfee=function(){
	scope.pagedata.post.no_di_cardfee=scope.pagedata.post.no_di_cardfee==1?0:1;
	if(scope.pagedata.post.no_di_cardfee==1){
		scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dicard_dispatch_endprice
		scope.pagedata.post.endprice = scope.pagedata.order.no_dicard_endprice
	}else{
		scope.pagedata.post.no_dispatch_price -= scope.pagedata.order.no_dispatch_cardfee
		scope.pagedata.post.endprice -= scope.pagedata.order.di_cardfee
		if(scope.pagedata.post.endprice<0){
			scope.pagedata.post.endprice=0
		}
		if(scope.pagedata.post.no_dispatch_price<0){
			scope.pagedata.post.no_dispatch_price=0
		}
	}
	scope.$evalAsync();
}
scope.pagedata.jieaddress=function(){
	scope.post_json('jy_aiaddress/get_data/jieaddress/',scope.pagedata.address,function(res){
		console.log(res);
		if(res.jieaddress){
			scope.pagedata.item.address=res.jieaddress;
			scope.$evalAsync();
		}
	});
}
scope.pagedata.pay_check=function(orderid){
    var onemerchid=scope.pagedata.onemerchid;
	if(scope.pagedata.order.sendtype==1){
		scope.pay_submit({},'jy_merch/order.create/pay/id='+orderid,'jy_merch/order.list//id='+orderid,'',onemerchid);
		return true;
	}
	scope.confirm({
		'message':'确认要现在买单吗？可以就餐后再买单的！',
		'success':function(){
			scope.pay_submit({},'jy_merch/order.create/pay/id='+orderid,'jy_merch/order.list//id='+orderid,'',onemerchid);
		},
		'fail':function(){}
	});
}
scope.pagedata.recharge=function(){
	scope.post_json('jy_merchcmi/order.create/recharge/',scope.pagedata.post,function(pay_id){
		console.log('pay_id');console.log(pay_id);
		scope.tool.pay(pay_id,function(res){
				console.log('收到支付结果！');
				if(res.type=='success'){
					scope.message('充值成功！');
				}else{
					scope.message('充值失败！'+res.message);
				}
		},'','','jy_merchcmi/order.create//id='+scope.pagedata.order.id);
	});
}
</script>
</div>
<div ng-include="sys_html('common/_footer')"></div>